package demo3LinkList;

import demo3LinkList.MyNodeAndMyList.NodeList;
import org.junit.Test;

/**
 * @ClassName $ {NAME}
 * @Description TODO
 * @Author shenxinyuan
 * @Date $ {DATE} $ {TIME}
 * @Version 1. 0
 **/

public class IntersectedListsNode {


    @Test
    public void test(){
        NodeList list1 = new NodeList();
        NodeList list2 = new NodeList();
        list1.addTail(1);
        list1.addTail(2);
        list1.addTail(3);
        list1.addTail(4);
        list1.addTail(5);
        //先构造一个相交链表，
        list2.addTail(11);
        list2.addTail(22);
        list2.addTail(33);
        list2.addTail(44);
        list1.makeCircle(list2,3);      //list2的44交到list1的值为4的节点

        System.out.println("相交节点的value:"+
                list1.findMeetPoint(list2,Math.abs(list1.size()-list2.size())).getValue());
    }

}
